using Crux.Core.NHibernate;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace Microsoft.Extensions.DependencyInjection;
/// <inheritdoc/>
public static class NHibernateServiceCollectionExtensions
{
    /// <inheritdoc/>
    public static IServiceCollection AddNHibernate(
       this IServiceCollection services)
    {
        services.TryAddSingleton(typeof(ISessionFactoryHelm<>), typeof(SessionFactoryHelm<>));
        services.TryAddScoped(typeof(IUnitOfWork<>), typeof(UnitOfWork<>));
        services.TryAddScoped(typeof(IQueryRepository<>), typeof(QueryRepository<>));
        services.TryAddScoped(typeof(ServiceProviderInterceptor));

        return services;
    }

}